package lab03.test01;

        import java.io.BufferedReader;
        import java.io.FileNotFoundException;
        import java.io.FileReader;
        import java.io.IOException;

/**
 * Created by 123 on 2017/12/8.
 */
public class Reader {
    public static void main(String[] args) {
        String path="D:\\Hello.txt";
        try {
            BufferedReader reader=new BufferedReader(new FileReader(path));

            //一次读一行字符
            String line="";
            while ((line=reader.readLine())!=null){
                System.out.println(line);
            }


            //一次读一个字符
            int current;
            while ((current=reader.read())!=-1){
                System.out.println((char)(current));
            }


        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
        String line="";
    }
}
